package com.jy.oms.framework.init;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 * init
 *
 * @author liuquan
 */
public interface InitializingService extends ApplicationListener<ContextRefreshedEvent> {

    @Override
    default void onApplicationEvent(ContextRefreshedEvent event) {
        if (event.getApplicationContext().getParent() == null) {
            initService(event.getApplicationContext());
        }
    }

    void initService(ApplicationContext applicationContext);
}
